﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TrackSystem.Entities.Extensions;

namespace TrackSystem.IO.Models
{
    /// <summary>
    /// IO单元基础类
    /// </summary>
    public class IOUnit
    {
        /// <summary>
        /// 唯一标识符
        /// </summary>
        //public Guid ID { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 属性信息
        /// </summary>
        public string? Attr { get; set; }

        /// <summary>
        /// 协议名称
        /// </summary>
        public ProtocolEnum Protocol { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 端口类型
        /// </summary>
        public PortCategory Type { get; set; }
        /// <summary>
        /// 是否是能
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 通信周期设定
        /// </summary>

        public int Interval { get; set; }
        /// <summary>
        /// 当前是否处于连接状态
        /// </summary>

        public bool Connected { get; set; }
        /// <summary>
        /// 目前是否在运行状态
        /// </summary>
        public bool Running { get; set; }
        /// <summary>
        /// 当前成功次数
        /// </summary>
        public int nSucc { get; set; }
        /// <summary>
        /// 当前失败次数
        /// </summary>
        public int nFail { get; set; }
        /// <summary>
        /// 循环周期时间ms
        /// </summary>
        public int Cycle { get; set; }
        /// <summary>
        /// 运行时间消耗时间ms
        /// </summary>
        public int Lapse { get; set; }

        /// <summary>
        /// 挂载的传感器列表
        /// </summary>
        public List<string>? SensorNameList {  get; set; }
    }
}
